package guoanmaker.personal.business.controller;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import guoanmaker.personal.business.service.PersonalCampaignServiceInterface;
import guoanmaker.personal.helper.common.AjaxJson;
import guoanmaker.personal.helper.common.abstractobj.ApiController;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(ApiController.CAMPAIGN_URL)
public class PersonalCampaignController {
	
	
	@Autowired  
	private  PersonalCampaignServiceInterface personalCampaignServiceInterface;
	
	@ApiOperation(value = "领取优惠券", notes = "领取优惠券")
	@RequestMapping(value = "/saveInvoice", method = RequestMethod.POST)
	public AjaxJson saveInvoice(String userid,String cid){
		AjaxJson ajaxJson=new AjaxJson();
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(personalCampaignServiceInterface.saveInvoice(userid, cid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(250).setMsg("操作失败").setData("领取失败");
		}
		return ajaxJson;
	}

}
